package dblayer;

import static org.junit.Assert.*;
import modellayer.Invoice;

import org.junit.Test;

public class DBInvoiceTest {
	
	InvoiceDB db = new InvoiceDB();

	@Test
	public void InsertToDataBase() {
		int success = -1;
		try {
			success = db.insertInvoice(new Invoice(1, "10/10/10 10:10:10", 2.50));
		} catch (Exception e) {
			fail("Failed to insert Invoice, exception: "+e);
		}
		
		if (success==-1) {
			fail("Fail to insert Invoice");
		}
	}
	@Test
	public void FindInvoiceByID() {
		if (db.findInvoice(1)==null) {
			fail("Find Invoice By ID failed");
		}
	}

}
